package com.video.demo.listener;

import com.video.demo.controller.VideoController;
import com.video.demo.domain.TaskEntity;
import com.video.demo.domain.VideoBackEvent;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.event.EventListener;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

import java.util.Map;

@Component
public class VideoBackListener {

    @Autowired
    private VideoController videoController;


    //监听 回放实体类的创建
    @Async
    @EventListener
    public void onApplicationEvent(VideoBackEvent event){
        //监听到回放

        Map getstockpile = videoController.getstockpile2(event.getRtsp(), event.getVideoName(), event.getAddressName());
        while (event.getA()==216000){
            //关闭存储视频
            videoController.stop(event.getVideoName());
        }
    }
}
